From 479e2ac76e034f3e80b3933c6c4c50bf04d61449 Mon Sep 17 00:00:00 2001 From: Andre Nijman Date: Mon, 8 Jun 2026 13:45:01 +0800 Subject: [PATCH] workspace: Avoid redundant boundingBox copies in window layout WorkspaceLayout's allocation reads child.boundingBox four times for each window on every frame of an overview transition. The getter returns a fresh copy of the cached box on every access, so this is four throwaway objects per window per frame feeding the garbage collector. Read the box into a local once and use that. The values are identical; only the per-frame allocations go away. Part-of: (cherry picked from commit d4b5bc781535104475fba490fccfb0dd7934c96f) --- js/ui/workspace.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/js/ui/workspace.js b/js/ui/workspace.js index 5c043e4be..3c8ed9f41 100644 --- a/js/ui/workspace.js +++ b/js/ui/workspace.js @@ -707,10 +707,11 @@ export const WorkspaceLayout = GObject.registerClass({ let workspaceBoxWidth, workspaceBoxHeight; if (windowInfo.metaWindow.showing_on_its_workspace()) { - workspaceBoxX = (child.boundingBox.x - workareaX) * allocationScale; - workspaceBoxY = (child.boundingBox.y - workareaY) * allocationScale; - workspaceBoxWidth = child.boundingBox.width * allocationScale; - workspaceBoxHeight = child.boundingBox.height * allocationScale; + const {boundingBox} = child; + workspaceBoxX = (boundingBox.x - workareaX) * allocationScale; + workspaceBoxY = (boundingBox.y - workareaY) * allocationScale; + workspaceBoxWidth = boundingBox.width * allocationScale; + workspaceBoxHeight = boundingBox.height * allocationScale; } else { workspaceBoxX = workareaX * allocationScale; workspaceBoxY = workareaY * allocationScale; -- 2.39.5